#!/usr/bin/env python
# coding=utf-8
import sys

__author__ = 'revol'

import unittest

from log2mongo import BaseHandler


class TestBaseHandler(unittest.TestCase):
    def setUp(self):
        self.bansehandler = BaseHandler()

    def test_format_exception(self):
        self.assertEqual(self.bansehandler.formatException(IOError('exception-test')),
                         {'type': 'exceptions.IOError',
                          'message': 'exception-test'})

    def test_format_frame(self):
        f=sys._getframe()
        print self.bansehandler.formatFrame(f)

if __name__ == '__main__':
    unittest.main(verbosity=2)
